package StudyCode.summary.zipfile;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.GZIPOutputStream;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CompressesByteArrayWithGzip {
	public static byte[] compress(byte[] theBytes) throws IOException {
		ByteArrayOutputStream bos = new ByteArrayOutputStream();
		GZIPOutputStream gos = new GZIPOutputStream(bos);
		gos.write(theBytes);
		gos.close();
		return bos.toByteArray();
	}
}
